home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programmer's Power Pack
/
Delphi Volume 1.iso
/
s_to_z
/
subdatab
/
subdatab.int
< prev
next >
Wrap
Text File
|
1996-09-15
|
5KB
|
147 lines
{
TSUBDataBase = class(TComponent)
A Database as Component
Siegfried Unterbarnscheidt
Ricarda-Huch-Str. 12
50858 K÷ln (GERMANY)
Compuserve-ID 101365,321
}
unit Subdatab;
interface
uses
SysUtils, WinTypes, WinProcs, Classes,Controls,
Dialogs,Dsgnintf,FileCtrl,
Subdata1,
Subdata2,
Subdata4,
Subdata5,
Subdata6;
Type
ESUBDBError = class(Exception) {defined in subdata4!}
public
ErrorCode: longint;
constructor Create(pErrorCode: longint;const Message: string);
end;
ESUBDBDuplicateIndexName = class(ESUBDBError);
ESUBDBDuplicateIndex = class(ESUBDBError);
Type
TReorgEvent = procedure(Sender: TObject; ReorgAct :longint) of object;
type
TSUBDataBase = class(TComponent)
private
{ Private-Deklarationen }
{...}
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{adminstration}
procedure Open; {by default the database opens automaticly}
procedure Close;
procedure Reorganisation;
Function createIndex (Const AName : String;
pKeyLaenge : byte; {max 63}
pdupl:boolean) : Boolean; {duplicate allowed?}
procedure DestroySUBFile; {simply delete the file! Attention}
{Indexkennstr is the "Name" of the index create by Createindex!}
{Index-Routinen}
Function CountKeys( Const IndexKennStr: String ) : Longint;
Function CountKeysLoHigh( Const IndexKennStr: String; loS,HiS : String ) : Longint;
Function GetPositionforKey( const IndexKennStr: String;
loS,SearchKey : KeyType; id : longint ) : Longint;
{loS = Starting with
KeyType = String[63] or keylaenge defined in createIndex}
Function NextIndex (Const IndexKennStr: String;
SuchSchluessel : KeyType ): String;
Function PrevIndex (Const IndexKennStr: String;
SuchSchluessel : KeyType ): String;
Function FirstLoIndex (Const IndexKennStr: String; SuchSchl : KeyType ): String;
Function FirstIndex (const IndexKennStr: String ): KeyType;
Function LastIndex (Const IndexKennStr: String ): KeyType;
{Data-Routinen:}
procedure ReadActData ( laenge : longint; var Data );
{ first, last, next, prev Index you can
directly read the data}
Function UpdateDataWithID ( ID : longint;NewDataSize : longint; var theData ) : Boolean;
Function DeleteDataWithID ( ID : longint ) : Boolean;
{data and Index-Routinen}
procedure addData_Indexe (Const IndexKennStr: array of Const;
Const IndexStr: array of Const;
laenge : longint; var Data );
{adding Data and all Index-Entryies with the data}
procedure UpdateData_Indexe (Const IndexKennStr: array of Const;
Const IndexStrOld: array of Const;
Const IndexStrNew: array of Const;
id : longint;
newDataSize : longint; var theData );
{you can a new datasize with newdatasize}
procedure DeleteData_Indexe (Const IndexKennStr: array of Const;
Const IndexStr: array of Const;
ID : longint );
{you get the id for the actual record with "Datenid"}
procedure DeleteDataWithIndex( Const IndexKennStr: String;IndexStr: String);
procedure ChangeIndex (Const IndexKennStr: String;
IndexStrold,IndexStrNeu: String);
PROCEDURE GetStatistik (var SL : TStringList);
property DatenID : longint;
Function addStream (var id :longint;Stream : TStream ) : Boolean;
Function ReadStream ( id :longint;Stream : TStream ) : Boolean;
property ReorgMax :longint;
published
{ Published-Deklarationen }
property DataBaseName: string;
property DataBaseDir: string;
property CreateonFail:Boolean;
property Active:Boolean;
property DestroyFile:Boolean;
property OnReorg: TReorgEvent;
property OnCreate: TNotifyEvent;
end;
implementation